NOTE: These instructions only apply if you want to use EJB2 (with CMP); if you use Hibernate or EJB3 JPA you can deploy the war from OpenXava directly in the WebSphere. It's not advisable to use EJB2 for new developments.
OpenXava generates J2EE aplications deployables in IBM Websphere Application Server 5.0, 5.1, 6.0 y 6.1.
Doing this simply requires executing a ant target that generates an EAR compatible with Websphere. Touching your code or XML files is not necessary.
This allows you developing your application using JBoss (hence in an agile way) and when it is ready for production deploy it in Websphere and of course test it.
This document is a guide for deploying an OpenXava application in Websphere. If you does not have one yet it's better that before this guide follow the tutorial of OpenXava, and you will obtain a MySchool.ear.
The next instructions work with Websphere 5.0, 5.1 and 6.0. In the examples you will connect to an AS/400, but is very easy using another database instead.
Create a J2EE Websphere compatible application
Open your Eclipse and make that it point to the workspace that comes with OpenXava distribution.
Edit MySchool/build.xml and set the variable configuration to websphere-as400.
Regenerate code, with the ant target MySchool.regenerateEJB.
Compile, click on Build.
Execute the target ant MySchool.createWebsphereEar.
And now you have in MySchool.dist a file named MySchool.ear ready to deploy in Websphere.
Install Websphere
This step is your own business. Use the IBM instructions about this topic and have luck. Install the last patch level too.
Setup Data Sources
Open the admin console, going to http://localhost:9090/admin (or http://localhost:9060/admin in version 6)
First you have to create a J2C entry, that contains an alias for an user/password that you will use in order to authenticate against your database.
In version 5/5.1: Go to Security >JAAS Configuration > J2C Authentication Data.
In version 6: Go to Security > Global Security > JAAS Configuration (on right) > J2C Authentication Data
Click New.
In Alias fielD type openxava (or another one of your choice).
In User ID field type the name of a database user.
In Password field type the password of that user.
Click OK.
Click Save that goes to another page and click in Save button.
Register your JDBC driver:
Go to Resources > JDBC Providers.
Click New.
In version 5/5.1:
In JDBC Providers field choose DB2 UDB for iSeries (Toolbox XA), or the driver for your database, always the XA version.
Click Apply.
In Classpath field type the path for your JDBC Driver (including jar name).
Click Apply.
In version 6:
Step 1: Choose DB2 (or your database type).
Step 2: DB2 UDB for iSeries (Toolbox) (or your provider type).
Step 3: XA data source (always this).
Click Next.
In Classpath field type the path for your JDBC Driver (including jar name).
Click Apply.
Register the Data Source for OpenXava:
Click in Data Sources (it's on bottom in 5/5.1, it's on right in 6).
Click New.
In Name field type OpenXavaDS
In JNDI Name field type jdbc/OpenXavaDS
In Component-managed Authentication Alias field choose xxxx/openxava.
In Container-managed Authentication Alias choose xxxx/openxava.
In version 5/5.1:
Click Apply.
Click Custom Properties, this goes to another page.
Click serverName and in Value field type the IP of your AS/400 (this only for AS/400).
Click OK.
In version 6:
In serverName field type the IP of your AS/400 (this only for AS/400).
Click OK.
Registre the Data Source for your application:
Go to Data Sources.
Click New.
In Name field type MySchoolDS
In JNDI Name field type jdbc/MySchoolDS
Check the checkbox Container managed persistence.
In Component-managed Authentication Alias field choose xxxx/openxava.
In Container-managed Authentication Alias choose xxxx/openxava.
In version 5/5.1:
Click Apply.
Click Custom Properties, this goes to another page.
Click serverName and in Value fiel type the IP of your AS/400 (this only for AS/400).
Click OK.
In version 6:
In serverName field type the IP of your AS/400 (this only for AS/400).
Click OK.
Click Save that goes to another page and click in Save button.
Verify the Data Sources just defined:
Go to Resources > JDBC Providers.
Click DB2 UDB for iSeries.
Click Data Sources (It's on bottom).
Choose the two data sources just created by you.
Click on Test Connection button.
If message is satisfactory you have concluded well this step.
Table of Contents
WebSphere EJB 2
NOTE: These instructions only apply if you want to use EJB2 (with CMP); if you use Hibernate or EJB3 JPA you can deploy the war from OpenXava directly in the WebSphere. It's not advisable to use EJB2 for new developments.OpenXava generates J2EE aplications deployables in IBM Websphere Application Server 5.0, 5.1, 6.0 y 6.1.
Doing this simply requires executing a ant target that generates an EAR compatible with Websphere. Touching your code or XML files is not necessary.
This allows you developing your application using JBoss (hence in an agile way) and when it is ready for production deploy it in Websphere and of course test it.
This document is a guide for deploying an OpenXava application in Websphere. If you does not have one yet it's better that before this guide follow the tutorial of OpenXava, and you will obtain a MySchool.ear.
The next instructions work with Websphere 5.0, 5.1 and 6.0. In the examples you will connect to an AS/400, but is very easy using another database instead.
Create a J2EE Websphere compatible application
Open your Eclipse and make that it point to the workspace that comes with OpenXava distribution.- Edit MySchool/build.xml and set the variable configuration to websphere-as400.
- Regenerate code, with the ant target MySchool.regenerateEJB.
- Compile, click on Build.
- Execute the target ant MySchool.createWebsphereEar.
And now you have in MySchool.dist a file named MySchool.ear ready to deploy in Websphere.Install Websphere
This step is your own business. Use the IBM instructions about this topic and have luck. Install the last patch level too.Setup Data Sources
Open the admin console, going to http://localhost:9090/admin (or http://localhost:9060/admin in version 6)First you have to create a J2C entry, that contains an alias for an user/password that you will use in order to authenticate against your database.
- In version 5/5.1: Go to Security >JAAS Configuration > J2C Authentication Data.
- In version 6: Go to Security > Global Security > JAAS Configuration (on right) > J2C Authentication Data
- Click New.
- In Alias fielD type openxava (or another one of your choice).
- In User ID field type the name of a database user.
- In Password field type the password of that user.
- Click OK.
- Click Save that goes to another page and click in Save button.
Register your JDBC driver:- Go to Resources > JDBC Providers.
- Click New.
- In version 5/5.1:
- In JDBC Providers field choose DB2 UDB for iSeries (Toolbox XA), or the driver for your database, always the XA version.
- Click Apply.
- In Classpath field type the path for your JDBC Driver (including jar name).
- Click Apply.
- In version 6:
- Step 1: Choose DB2 (or your database type).
- Step 2: DB2 UDB for iSeries (Toolbox) (or your provider type).
- Step 3: XA data source (always this).
- Click Next.
- In Classpath field type the path for your JDBC Driver (including jar name).
- Click Apply.
Register the Data Source for OpenXava:- Click in Data Sources (it's on bottom in 5/5.1, it's on right in 6).
- Click New.
- In Name field type OpenXavaDS
- In JNDI Name field type jdbc/OpenXavaDS
- In Component-managed Authentication Alias field choose xxxx/openxava.
- In Container-managed Authentication Alias choose xxxx/openxava.
- In version 5/5.1:
- Click Apply.
- Click Custom Properties, this goes to another page.
- Click serverName and in Value field type the IP of your AS/400 (this only for AS/400).
- Click OK.
- In version 6:
- In serverName field type the IP of your AS/400 (this only for AS/400).
- Click OK.
Registre the Data Source for your application:- Go to Data Sources.
- Click New.
- In Name field type MySchoolDS
- In JNDI Name field type jdbc/MySchoolDS
- Check the checkbox Container managed persistence.
- In Component-managed Authentication Alias field choose xxxx/openxava.
- In Container-managed Authentication Alias choose xxxx/openxava.
- In version 5/5.1:
- Click Apply.
- Click Custom Properties, this goes to another page.
- Click serverName and in Value fiel type the IP of your AS/400 (this only for AS/400).
- Click OK.
- In version 6:
- In serverName field type the IP of your AS/400 (this only for AS/400).
- Click OK.
- Click Save that goes to another page and click in Save button.
Verify the Data Sources just defined:- Go to Resources > JDBC Providers.
- Click DB2 UDB for iSeries.
- Click Data Sources (It's on bottom).
- Choose the two data sources just created by you.
- Click on Test Connection button.
If message is satisfactory you have concluded well this step.Create tables in database
Execute the next script against your DB:Install application
In order to install your application you have to do:Execute the application
Now everything is ready to execute you application in Websphere:- Go to Applications > Enterprise Applications.
- Choose MySchool application.
- Click Start.
- With your Internet Browser go to http://localhost:9080/MySchool/xava/module.jsp?application=MySchool&module=Teachers.
- Test your application.
Also you can execute your JUnit Test, in your Eclipse: